< previous page page_265 next page >

Page 265
They must be declared as Long variables. You'll have to extract the string information from the pointers using VB code.
First Code Test
My next step was to set a breakpoint at the Call SHFreeNameMappings line in the DoACopy function shown below:
' Perform a copy operation
Private Sub DoACopy()
   Dim sh As SHFILEOPSTRUCT
   Dim src$, dest$
   Dim res&

   src$ = GetNullsString(FileList)
   dest$ = "A:\" & Chr$(0) & Chr$(0)

   sh.hwnd = hwnd
   sh.wFunc = FO_COPY
   sh.pFrom = src$
   sh.pTo = dest$
   sh.fFlags = FOF_RENAMEONCOLLISION Or FOF_WANTMAPPINGHANDLE
   sh.hNameMappings = 0

   res = DoTheShellCall(sh, "Files are being copied to floppy")

   If sh.hNameMappings <> 0 Then
         ' Can you read the file names here?
      Call SHFreeNameMappings(sh.hNameMappings)
   End If

End Sub
Why did I test the code at this point before any code was written to work with the data? Curiosity, mostly. Also, I was feeling a growing distrust of the documentation. It was very vaguereferring to the sh.hNameMappings field as a "handle." What does that mean? Is it a pointer to an array of structures? If so, how do you know how many structures are in the array? Perhaps the final structure is a NULL structure or a structure with empty strings? Perhaps the handle is an array of pointers to structures? I spent a good half hour scouring MSDN and Microsoft's Web site for hints before coming up dry. So I wanted to see what kind of values the field would have.

 
< previous page page_265 next page >